package cn.edu.tju.elm.mapper;

import cn.edu.tju.elm.dto.BusinessCreateDTO;
import cn.edu.tju.elm.dto.BusinessResponseDTO;
import cn.edu.tju.elm.model.Business;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;

import java.util.List;

/**
 * ClassName: BusinessMapper
 * Package: cn.edu.tju.elm.mapper
 * Description: 店铺实体和DTO转换器
 *
 * @Author Niu Wenhang
 * @Create 2025/9/20 12:00
 * @Version 1.0
 */
@Mapper(componentModel = "spring")
public interface BusinessMapper {

    @Mapping(source = "businessOwner", target = "businessOwner")
    Business dtoToBusiness(BusinessCreateDTO dto);

    @Mapping(source = "businessOwner.id", target = "businessOwnerId")
    BusinessResponseDTO businessToResponseDTO(Business business);

    List<BusinessResponseDTO> businessesToResponseDTOs(List<Business> businesses);
}